﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example.aspx.cs" Inherits="DreamCube.Websites.UI.Common.JQ.Controls.ComboBox.Example" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <DC:JQControlsCSS runat="server" />
    <div id="div_combobox">
        <input type="text" value="" id="input_combobox1" dropdownStyle="dropDownList" listItems="vv;ee;rr;qq" />
        <input type="text" value="" id="input_combobox2" listItems="aa|1;dd|2;cc|3;aa|4" />
        <span id="span_combobox"></span>
        <input type="button" value="查看选中的值" onclick="ShowSelectedValue()" />
    </div>
    <DC:MyJS runat="server" />
    <DC:JQJS runat="server" />
    <DC:JQControlsJS runat="server" />
    </form>
</body>
</html>
<script type="text/javascript">
    $(document).ready(function () {
        $("#input_combobox1").setComboBox();
        $("#input_combobox2").setComboBox();

        var combobox = new ComboBox({ listItems: '1;2;3;4' });
        combobox.appendTo("span_combobox");
    });

    function ShowSelectedValue() {
        var values = $("#input_combobox1").getComboBoxValue();
        alert("第一个combobox选中的文本是：" + values[0] + "，值是：" + values[1]);
        var values2 = $("#input_combobox2").getComboBoxValue();
        alert("第二个combobox选中的文本是：" + values2[0] + "，值是：" + values2[1]);
    };
</script>